package org.seckill.Common;

/**
 * Created by ASUS on 2017/7/31.
 */
public class Const {


    public enum SeckillStatus{
        SUCCESS(1,"秒杀成功"),
        END(0,"秒杀结束"),
        REPEAT_KILL(-1,"重复秒杀"),
        INNER_ERROR(-2,"系统异常"),
        DATA_REWRITE(-3,"数据篡改");
        private int status;
        private String desc;
        SeckillStatus(int status,String desc){
            this.status=status;
            this.desc=desc;
        }

        public static SeckillStatus getSeckillStatus(int status){
            for(SeckillStatus seckillStatus: values()){
                if(seckillStatus.getStatus()==status){
                    return seckillStatus;
                }
            }
            return null;
        }

        public int getStatus() {
            return status;
        }

        public String getDesc() {
            return desc;
        }
    }
}
